import { ref } from 'vue'

const time   = ref('00:00:00')
const timeFn = () => {
    const d = new Date()
    const y = d.getHours()
    const m = d.getMinutes() < 10 ? '0' + d.getMinutes : d.getMinutes()
    const t = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()

    time.value = `${y}:${m}:${t}`
    setTimeout(timeFn, 1000)
}

export {time, timeFn}